<?php

/**
 * OperadoresPrestamos form.
 *
 * @package    cronos-doctrine
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class OperadoresPrestamosForm extends BaseOperadoresPrestamosForm
{
  public function configure()
  {
      
      unset(
          $this['created_at'],
          $this['updated_at']
      );
     
     $this->widgetSchema['empresa_id'] = new sfWidgetFormInputHidden(array(),array('value'=> sfContext::getInstance()->getUser()->getAttribute('agente_user_empresa_id')));
     $this->widgetSchema['cantidad'] =  new sfWidgetFormInputText(array(),array('value' => 1));
     $this->widgetSchema['fecha'] = new sfWidgetFormInput(array(), array('size' => 15, 'id' => 'fechaDashboard', 'readonly'=>'readonly'));
     
     
     $concepto_cf = new ConceptoCf();
     $this->widgetSchema['concepto_cf_id'] = new sfWidgetFormDoctrineChoice(array(
                      'model'     => 'ConceptoCf',
                      'key_method'=>'getId',
                      'query'    => $concepto_cf->getConceptoCfquery(),
        ));
     
     $this->widgetSchema['monto_pagado'] = new sfWidgetFormInputHidden();
     
     $this->widgetSchema['operador_id'] = new sfWidgetFormDoctrineChoice(array(
         'multiple' => false, 
         'model' => 'sfGuardUser',
         'query' => Doctrine_Query::create()->select('sf.id,sf.username')
                                    ->from('sfGuardUser sf')
                                    ->leftJoin('sf.sfGuardUserPermission s')
                                    ->where('sf.is_active = 1')
                                    ->addWhere('sf.empresa_id=?', sfContext::getInstance()->getUser()->getAttribute('agente_user_empresa_id'))
                                    ->addWhere('s.permission_id=7')
                                    ->addWhere('s.permission_id=7')
                                    ->orderBy('sf.username asc'),
         'expanded' => false));
       
      $this->widgetSchema['financiamiento'] =new sfWidgetFormInputText();
     
           //Cambiar a lista y su validador d
      $this->widgetSchema['dias'] = new sfWidgetFormChoice(array(
         'choices' => OperadoresPrestamos::$dias,
         'expanded' => true,
         'multiple' => true,
      ));
      
      
            $this->validatorSchema['dias'] = new sfValidatorChoice( 
                  array('choices'=>array_keys(OperadoresPrestamos::$dias),
                  'multiple'=>true, 'required'=>false
         ));
      
      
  }
  
  
  
}
